from django.db import models
# ! coding=utf-8

class Metal(models.Model):
    #事故名称
    accident=models.CharField(max_length=50)
    #重金属类型
    metal_kind=models.CharField(max_length=50)
    metal_kind_en=models.CharField(max_length=50)
    #时间
    time=models.CharField(max_length=50)
    #事故地点
    accident_place=models.CharField(max_length=50)
    #经度
    longitude=models.CharField(max_length=50)
    #纬度
    latitude=models.CharField(max_length=50)
    #行业类型
    occupation_standard=models.CharField(max_length=50)
    occupation_standard_en=models.CharField(max_length=50)
    #事故后描述
    accident_description=models.CharField(max_length=2000)
    #受害的大类
    viticm_kind=models.CharField(max_length=50)
    #受体名称
    viticm_kind_name=models.CharField(max_length=50)
    #受体数量 受害人数
    viticm_kind_count=models.CharField(max_length=50,null=True,blank=True)



#处置过程
class DisposeProgram(models.Model):
    metal=models.ForeignKey(Metal)
    pollution_measure=models.CharField(max_length=2000)
    environment_measure=models.CharField(max_length=2000)
    crowd_measure=models.CharField(max_length=2000)
    information_measure=models.CharField(max_length=2000)
    after_measure=models.CharField(max_length=2000)
    law_measure=models.CharField(max_length=2000)


#新闻链接
class  NewsLink(models.Model):
    metal=models.ForeignKey(Metal)
    news_link=models.CharField(max_length=100,null=True)
    def __unicode__(self):
        return '%s-%s' %(self.metal,self.news_link)
#图片存在
class Image(models.Model):
    metal=models.ForeignKey(Metal)
    imagename=models.CharField(verbose_name=u'图片名称',max_length=100,null=True)
    image=models.ImageField(upload_to='attachment/images/%Y/%m/%d',null=True,blank=True)


class MyUserModel(models.Model):
    username = models.CharField(u'用户名',max_length=60, unique=True)
    password = models.CharField(u'密码',max_length=60)
    name = models.CharField(u'姓名',max_length=60)
    user_id = models.IntegerField(u'用户id',null=True)
    is_staff=models.BooleanField(u'帐号为管理员',default=True,help_text=u'无效请取消勾选')
    is_active = models.BooleanField(u'帐号是否有效',default=True,help_text=u'无效请取消勾选')